import request from "@/utils/request";
import { getQueryObj } from "@/utils/common";
enum Api {
  test1 = "/FundamentalProxy/FundamentalProxy",
}

const $lang = getQueryObj(location.href).Lang;
const $stockcode = getQueryObj(location.href).stockcode;
let lang = "en";
let stockcode = "700.HK";
if ($lang == "en") {
  lang = "en";
} else if ($lang == "zh-HK") {
  lang = "zh-HK";
} else if ($lang == "zh-CN") {
  lang = "zh-CN";
}
if($stockcode == "700.HK"){
  stockcode = "700.HK"
}else if($stockcode == "11.HK"){
  stockcode = "11.HK"
}
export const getList = () => {
  return request.get<any, null>(Api.test1 + `?ric=${stockcode}&type=0&lang=${lang}`);
};
//资产负债表
export const getBalanceSheet = () => {
  return request.get<any, null>(
    Api.test1 + `?ric=${stockcode}&type=4&statementType=F&lang=${lang}`
  );
};
//损益表
export const getProfileLoss = () => {
  return request.get<any, null>(
    Api.test1 + `?ric=${stockcode}&type=3&statementType=F&lang=${lang}`
  );
};
//财务比率
export const getFinancialRatio = () => {
  return request.get<any, null>(
    Api.test1 + `?ric=${stockcode}&type=5&statementType=F&lang=${lang}`
  );
};
//现金流量表
export const getCashFlow = () => {
  return request.get<any, null>(
    Api.test1 + `?ric=${stockcode}&type=6&statementType=F&lang=${lang}`
  );
};
//派息
export const getEntitlementHistory = () => {
  return request.get<any, null>(Api.test1 + `?ric=${stockcode}&type=8&lang=${lang}`);
};
//招股记录
export const getListStatistics = () => {
  return request.get<any, null>(
    Api.test1 + `?ric=${stockcode}&type=10&statementType=F&lang=${lang}`
  );
};
